package observer_pattern.v1;

/**
 * 客户端主类
 * @author ricejson
 */
public class Main {
    public static void main(String[] args) {
        // 前台小姐
        Secretary tongzizhe = new Secretary("tongzizhe");
        // 看股票的同事
        StockObserver tongshi1 = new StockObserver("魏关姹", tongzizhe);
        StockObserver tongshi2 = new StockObserver("易管查", tongzizhe);
        // 前台记下两位同事
        tongzizhe.attach(tongshi1);
        tongzizhe.attach(tongshi2);
        // 发现老板回来
        tongzizhe.setAction("老板回来啦");
        // 通知两个同事
        tongzizhe.broadcast();
    }
}
